package com.contact;

import android.app.ActivityGroup;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
import android.widget.ImageView;

import com.matang.R;
import com.modle.User;
import com.pyq.PyqMainFragment;
import com.util.UserUtil;

public class ContactMainActivity extends ActivityGroup  implements OnClickListener{
	private ImageView imgTxl;
	private ImageView imgZjlx;
	private ImageView imgpyq;
	private ImageView imgWe;
	private ImageView imgsp;
	private FrameLayout frameParent;
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.contact_mian);
		init();
	}

	private void init() {
		findView();
		setData();
		setOnCliker();

	}

	private void setOnCliker() {
		imgsp.setOnClickListener(this);
		imgTxl.setOnClickListener(this);
		imgZjlx.setOnClickListener(this);
		imgpyq.setOnClickListener(this);
		imgWe.setOnClickListener(this);
		imgTxl.performClick();
	}

	private void setData() {
		frameParent = (FrameLayout) findViewById(R.id.frame_parent);
		imgsp = (ImageView) findViewById(R.id.tv_mtsp);
		imgTxl = (ImageView) findViewById(R.id.tv_txl);
		imgZjlx = (ImageView) findViewById(R.id.tv_zjlxr);
		imgpyq = (ImageView) findViewById(R.id.tv_pyq);
		imgWe = (ImageView) findViewById(R.id.tv_wd);

	}

	private void findView() {


	}

	@SuppressWarnings("deprecation")
	public void onClick(View view) {
		switch (view.getId()) {
		case R.id.tv_txl://通讯录

			frameParent.removeAllViews();  
			frameParent.addView(getLocalActivityManager().startActivity("one",  
					new Intent(ContactMainActivity.this, TabFriendActivity.class))  
					.getDecorView());
			break;
		case R.id.tv_zjlxr://最近联系人
			frameParent.removeAllViews();  
			frameParent.addView(getLocalActivityManager().startActivity("two",  
					new Intent(ContactMainActivity.this, TabRecentIyrActivity.class))  
					.getDecorView());
			break;

		case R.id.tv_pyq://朋友圈
			frameParent.removeAllViews();  
			frameParent.addView(getLocalActivityManager().startActivity("three",  
					new Intent(ContactMainActivity.this, PyqMainFragment.class))  
					.getDecorView());
			break;

		case R.id.tv_wd:
			frameParent.removeAllViews();  
			Intent intent = new Intent(ContactMainActivity.this, UserSimpleInfoActivity.class);
			User user = UserUtil.readUser();
			intent.putExtra("fUserID", user);
			frameParent.addView(getLocalActivityManager().startActivity("four",intent).getDecorView());

			break;
		case R.id.tv_mtsp:
			Intent intent2 = new Intent();
			intent2.setClass(getApplicationContext(), VedioListActivity.class);
			startActivity(intent2);
			break;


		default:
			break;
		}

	}

}
